{layout name="public/layout" /}
{include file='yxnavbar'}


<div class="main">
    {include file='weike/template/navbar'}
    <form id="group_form" action="./index.php" method="post" class="form-horizontal" role="form">
        <div class="panel panel-default" role="tabpanel" style="">
            <div class="panel-heading">模板基础设置</div>
            <div class="panel-body">
            <input type="hidden" name="template_id" value="{$template_id}"/>
            <input type="hidden" name="themeid" value="{$themeid}"/>
            <div class="form-group" >
                <label class="col-sm-2 col-xs-12 control-label">模板名称</label>
                <div class="col-sm-8 col-xs-12">
                    <div class="input-group">
                        <input type="text" class="form-control"  placeholder="请输入模板名称" name="name"  value="{php echo !$template_id?'':$data['name'];}">
                        <span class="input-group-addon"></span>
                    </div>
                    <span class="help-block"></span>
                </div>
            </div>

            <div class="form-group">
                <label class="col-sm-2 col-xs-12 control-label">是否启用</label>
                <div class="col-sm-9 col-md-8 col-lg-8 col-xs-12">
                    <label class="radio-inline">
                        <input name="status" value="1" {if !$template_id || $data['status']} checked="checked"{/if} type="radio">启用
                    </label>
                    <label class="radio-inline">
                        <input name="status" value="0" {if $template_id && $data['status']==0} checked="checked"{/if} type="radio">禁用
                    </label>
                </div>
            </div>
        </div>
        </div>
        <div class="panel panel-default" role="tabpanel" style="">
            <div class="panel-heading">样式设置</div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-sm-2 col-xs-12 control-label">主题色</label>
                    <div class="col-sm-5 col-xs-12">
                        {php echo view_form_field_color('wk_theme_color',$temp_config['wk_theme_color']?:'');}
                        <span class="help-block">页面头部标题栏背景颜色与限量领取N张背景颜色</span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 col-xs-12 control-label">客片信息背景图</label>
                    <div class="col-sm-8 col-xs-12">
                        {php echo view_form_field_image('wk_user_info_bg',!isset($temp_config['wk_user_info_bg'])?'':$temp_config['wk_user_info_bg']);}
                        <span class="help-block"></span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 col-xs-12 control-label">打call宝贝人气</label>
                    <div class="col-sm-8 col-xs-12">
                        {php echo view_form_field_image('wk_call_left_bg',!isset($temp_config['wk_call_left_bg'])?'':$temp_config['wk_call_left_bg']);}
                        <span class="help-block"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 col-xs-12 control-label">打call宝贝人气图标</label>
                    <div class="col-sm-8 col-xs-12">
                        {php echo view_form_field_image('wk_call_left_icon',!isset($temp_config['wk_call_left_icon'])?'':$temp_config['wk_call_left_icon']);}
                        <span class="help-block"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 col-xs-12 control-label">打call解锁礼品</label>
                    <div class="col-sm-8 col-xs-12">
                        {php echo view_form_field_image('wk_call_right_bg',!isset($temp_config['wk_call_right_bg'])?'':$temp_config['wk_call_right_bg']);}
                        <span class="help-block"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 col-xs-12 control-label">打call解锁礼品图标</label>
                    <div class="col-sm-8 col-xs-12">
                        {php echo view_form_field_image('wk_call_right_icon',!isset($temp_config['wk_call_right_icon'])?'':$temp_config['wk_call_right_icon']);}
                        <span class="help-block"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 col-xs-12 control-label">打call中间背景</label>
                    <div class="col-sm-8 col-xs-12">
                        {php echo view_form_field_image('wk_call_center_bg',!isset($temp_config['wk_call_center_bg'])?'':$temp_config['wk_call_center_bg']);}
                        <span class="help-block"></span>
                    </div>
                </div>
                <div class="form-group">
                    <label class="col-sm-2 col-xs-12 control-label">打call底部背景</label>
                    <div class="col-sm-8 col-xs-12">
                        {php echo view_form_field_image('wk_call_bottom_bg',!isset($temp_config['wk_call_bottom_bg'])?'':$temp_config['wk_call_bottom_bg']);}
                        <span class="help-block"></span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 col-xs-12 control-label">打call按钮图片</label>
                    <div class="col-sm-8 col-xs-12">
                        {php echo view_form_field_image('wk_give_call_button_img',!isset($temp_config['wk_give_call_button_img'])?'':$temp_config['wk_give_call_button_img']);}
                        <span class="help-block"></span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 col-xs-12 control-label">送礼物广告图片</label>
                    <div class="col-sm-8 col-xs-12">
                        {php echo view_form_field_image('wk_give_gift_ad_img',!isset($temp_config['wk_give_gift_ad_img'])?'':$temp_config['wk_give_gift_ad_img']);}
                        <span class="help-block"></span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 col-xs-12 control-label">领取礼包广告图片</label>
                    <div class="col-sm-8 col-xs-12">
                        {php echo view_form_field_image('wk_get_gift_ad_img',!isset($temp_config['wk_get_gift_ad_img'])?'':$temp_config['wk_get_gift_ad_img']);}
                        <span class="help-block"></span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 col-xs-12 control-label">领取礼包悬浮按钮</label>
                    <div class="col-sm-8 col-xs-12">
                        {php echo view_form_field_image('wk_get_gift_icon',!isset($temp_config['wk_get_gift_icon'])?'':$temp_config['wk_get_gift_icon']);}
                        <span class="help-block"></span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 col-xs-12 control-label">内容图中领取礼包按钮</label>
                    <div class="col-sm-8 col-xs-12">
                        {php echo view_form_field_image('wk_content_get_gift_button',!isset($temp_config['wk_content_get_gift_button'])?'':$temp_config['wk_content_get_gift_button']);}
                        <span class="help-block"></span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 col-xs-12 control-label">内容图中领取礼包按钮位置</label>
                    <div class="col-sm-8 col-xs-12">
                        <div class="input-group">
                            <span class="input-group-addon">图片宽百分比</span>
                            <input type="number" class="form-control" max="100" min="0.1" step="0.1" placeholder="" name="wk_content_get_gift_button_width"  value="{php echo !isset($temp_config['wk_content_get_gift_button_width'])?0:$temp_config['wk_content_get_gift_button_width'];}">
                            <span class="input-group-addon">%</span>
                            <span class="input-group-addon">距离内容图顶部距离</span>
                            <input type="number" class="form-control" min="0" placeholder="" name="wk_content_get_gift_button_top"  value="{php echo !isset($temp_config['wk_content_get_gift_button_top'])?0:$temp_config['wk_content_get_gift_button_top'];}">
                            <span class="input-group-addon">rpx</span>
                        </div>
                    </div>
                </div>
            </div>
        </div>
        <div class="panel panel-default" role="tabpanel" style="">
            <div class="panel-heading">按扭配置</div>
            <div class="panel-body" style="">

                <div class="form-group">
                    <label class="col-sm-2 col-xs-12 control-label">送Ta礼物按扭颜色</label>
                    <div class="col-sm-5 col-xs-12">
                        {php echo view_form_field_color('wk_button_left_bg_color',$temp_config['wk_button_left_bg_color']?:'');}
                        <span class="help-block">送Ta礼物按扭的背景色</span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 col-xs-12 control-label">领取礼包按扭颜色</label>
                    <div class="col-sm-5 col-xs-12">
                        {php echo view_form_field_color('wk_button_right_bg_color',$temp_config['wk_button_right_bg_color']?:'');}
                        <span class="help-block">领取礼包按扭的背景色</span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 col-xs-12 control-label">表单提交按扭颜色</label>
                    <div class="col-sm-5 col-xs-12">
                        {php echo view_form_field_color('wk_button_form_bg_color',$temp_config['wk_button_form_bg_color']?:'');}
                        <span class="help-block">表单提交按扭的背景色</span>
                    </div>
                </div>
            </div>

        </div>
        <div class="panel panel-default" role="tabpanel" style="">
            <div class="panel-heading"> 特权礼包配置 </div>
            <div class="panel-body">
                <div class="form-group">
                    <label class="col-sm-2 col-xs-12 control-label">特权礼包背景图</label>
                    <div class="col-sm-8 col-xs-12">
                        {php echo view_form_field_image('wk_gift_bag_bg',!isset($temp_config['wk_gift_bag_bg'])?'':$temp_config['wk_gift_bag_bg']);}
                        <span class="help-block"></span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 col-xs-12 control-label">特权礼包内容文字颜色</label>
                    <div class="col-sm-5 col-xs-12">
                        {php echo view_form_field_color('wk_gift_bags_text_color',$temp_config['wk_gift_bags_text_color']?:'');}
                        <span class="help-block"></span>
                    </div>
                </div>

                <div class="form-group">
                    <label class="col-sm-2 col-xs-12 control-label">倒计时背景图</label>
                    <div class="col-sm-8 col-xs-12">
                        {php echo view_form_field_image('wk_time_bg',!isset($temp_config['wk_time_bg'])?'':$temp_config['wk_time_bg']);}
                        <span class="help-block"></span>
                    </div>
                </div>
            </div>
        </div>
        <div class="form-group" id="sub_upload" >
            <div class="col-sm-12">
                <input name="submit" onclick="addOrEditItem()" id="btnConfirm" type="button" value="提交" class="btn btn-primary col-lg-2">
            </div>
        </div>
    </form>
</div>


{$pager}
<script type="text/javascript">
    $(document).ready(
        function (){
            console.log('js代码');
        }
    );
    //新增\修改 提交数据
    function addOrEditItem() {
        let postUrl = "{php echo createWebUrlPlugin('weike.template.addinfo',array('themeid'=>$themeid));}";
        let success_redirect = "{php echo createWebUrlPlugin('weike.template.main',array('themeid'=>$themeid));}";
        let formData = $("#group_form").serialize();
        $.ajax({
            url:postUrl,
            dataType:'json',
            method:'post',
            data:formData,
            success:function (e) {
                console.log(e)
                let status = e.status;
                let result = e.result;
                if (status!=1){
                    layer.msg(result.message)
                }else{
                    layer.msg(result.message);
                    window.location.href = success_redirect;
                }
            },
            fail:function (err) {
                console.log(err)
            }
        })
    }
</script>
